package com.it.base.arithmetic.base.dm.proxy.dynamic.JDK;

import com.it.base.arithmetic.base.dm.proxy.staticProxy.BuyHouse;
import com.it.base.arithmetic.base.dm.proxy.staticProxy.BuyHouseImpl;

import java.lang.reflect.Proxy;

public class Test {
    public static void main(String[] args) {
        BuyHouse buyHouse = new BuyHouseImpl();
        //获取一个代理对象
        BuyHouse buyHouseProxy = (BuyHouse)Proxy.newProxyInstance(BuyHouse.class.getClassLoader(),new Class[]{BuyHouse.class},new DynamicProxyHandler(buyHouse));
        //执行代理对象的方法
        buyHouseProxy.buyHouse();
    }
}
